package com.system.manager.modules.projectLibrary.service.impl;

import com.system.manager.common.exception.SysException;
import com.system.manager.modules.authorized.entity.Subject;
import com.system.manager.modules.authorized.entity.User;
import com.system.manager.modules.authorized.mapper.UserMapper;
import com.system.manager.modules.projectLibrary.entity.ProjectRecord;
import com.system.manager.modules.projectLibrary.enums.ProjectLibraryErrorCode;
import com.system.manager.modules.projectLibrary.exception.ProjectLibraryException;
import com.system.manager.modules.projectLibrary.mapper.ProjectRecordMapper;
import com.system.manager.modules.projectLibrary.service.IProjectRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author jisf
 * @since 2021-11-10
 */
@Service
public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordMapper, ProjectRecord> implements IProjectRecordService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private ProjectRecordMapper projectRecordMapper;

    /**
     * TODO 插入项目记录
     *
     * @param projectRecord
     */
    @Override
    public void insertProjectRecord(ProjectRecord projectRecord) {

        //插入项目记录
        try {
            projectRecordMapper.insert(projectRecord);
        } catch (Exception e) {
            throw new SysException();
        }

    }

    /**
     * TODO 修改项目记录
     *
     * @param projectRecord
     */
    @Override
    public void updateProjectRecord(ProjectRecord projectRecord) {

        //修改项目记录
        try {
            projectRecordMapper.updateById(projectRecord);
        } catch (Exception e) {
            throw new SysException();
        }

    }
}
